package com.neusoft.neuiotms.dcom.model;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.EnumType;
import javax.persistence.Enumerated;
import javax.persistence.Lob;
import javax.persistence.Table;
import javax.validation.constraints.NotBlank;

import org.hibernate.validator.constraints.Length;

import com.neusoft.bizcore.web.jpa.model.AbstractAuditModel;
import com.neusoft.bizcore.web.jpa.model.Comment;
import com.neusoft.neuiotms.dcom.model.enums.MaintainRuleSource;
import com.neusoft.neuiotms.dcom.model.enums.MaintainRuleStatus;

import lombok.Getter;
import lombok.Setter;

@Getter
@Setter
@Entity
@Table(name = "neuiot_maintain_rule")
@org.hibernate.annotations.Table(appliesTo = "neuiot_maintain_rule", comment = "维护规则表")
public class MaintainRule extends AbstractAuditModel {

    private static final long serialVersionUID = 1L;

    @Length(max = 50, message = "规则编码不能超过{max}位")
    @Column(length = 50, nullable = false)
    @Comment("varchar(50) NOT NULL COMMENT '规则编码'")
    private String code;

    @NotBlank(message = "规则名称")
    @Length(max = 100, message = "名称不能超过{max}位")
    @Column(length = 100, nullable = false)
    @Comment("varchar(100) NOT NULL COMMENT '规则编码'")
    private String name;

    @Length(max = 50, message = "维护类别Code不能超过{max}位")
    @Column(length = 50, nullable = false)
    @Comment("varchar(50) NOT NULL COMMENT '维护类别Code'")
    private String modelCode;

    @Length(max = 100, message = "维护类别名称不能超过{max}位")
    @Column(length = 100, nullable = true)
    @Comment("varchar(100) NULL COMMENT '维护类别名称'")
    private String modelName;

    @Comment("bit(1) COMMENT '是否停止服务'")
    private boolean suspendService = false;

    @Enumerated(EnumType.STRING)
    @Column(length = 25, nullable = false)
    @Comment("varchar(25) NOT NULL COMMENT '规则状态'")
    private MaintainRuleStatus status = MaintainRuleStatus.disable;

    @Comment(" COMMENT '量化时间(小时)'")
    private int quantifyingTime;

    @Lob
    @Column(columnDefinition = "longtext")
    @Comment("text COMMENT '维护说明'")
    private String description;

    @Comment("BIGINT COMMENT '创建人Id'")
    private Long userId;

    @Length(max = 100, message = "创建人名称不能超过{max}位")
    @Column(length = 100, nullable = true)
    @Comment("varchar(100) NULL COMMENT '创建人名称'")
    private String userName;

    @Enumerated(EnumType.STRING)
    @Column(length = 25, nullable = true)
    @Comment("varchar(25) NULL COMMENT '来源'")
    private MaintainRuleSource source = MaintainRuleSource.newcreate;

}
